﻿using Beetle.Demo.Services.Abstractions;
using Beetle.Modules.BtHttpClientModule;
using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Beetle.Demo.SharedUI;

public partial class DemoPage_Books : ComponentBase
{
    [Inject]
    private IBtHttpClient _BtClient { get; set; } = default!;
    private int _BookCount = 0;
    private string[] _Books = new string[0];

    protected override async Task OnInitializedAsync()
    {
        await base.OnInitializedAsync();
        // 创建服务。
         var service = _BtClient.CreateRawService<IDemoDataService>();
        // 调用服务。
        _BookCount = await service.GetBookCount();
        _Books = await service.GetBooks();
    }
}
